class Solution(object):
    def duplicateInArray(self, nums):
        """
        :type nums: List[int]
        :rtype int
        """
        for x in nums:
            if x >= len(nums) or x < 0 or len(nums) == 0:
                return -1

        for i in range(0, len(nums)-1):
            for j in range(i+1, len(nums)):
                if nums[i] == nums[j]:
                    return nums[j]
        
        return -1